<?php

namespace App;

use Encore\Admin\Traits\DefaultDatetimeFormat;
use Illuminate\Database\Eloquent\Model;

class Agency extends Model
{
    use DefaultDatetimeFormat;

    protected $table = 'admin_users';

    protected $casts = ['data' => 'json'];


    public static function selectOptions()
    {
        return self::query()->where('role_type', 4)->where('enabled', 1)
            ->orderBy('order')
            ->orderByDesc('id')
            ->pluck('company', 'id');
    }

    public static function selectAllOptions(): array
    {
        return self::query()->where('role_type', 4)
            ->orderBy('order')
            ->orderByDesc('id')
            ->pluck('company', 'id')->toArray();
    }
}
